package com.crc.luojian.controller;

import com.crc.luojian.annotation.*;
import com.crc.luojian.dto.Test;
import com.crc.luojian.service.AService;
import lombok.Data;

import javax.servlet.http.HttpServletRequest;
import java.sql.SQLException;

/**
 * @program: luojian-springframework
 * @description:
 * @author: luojian58
 * @create: 2021-06-11 11:15
 */
@Controller
@RequestMapping(value = "/test")
public class TestController {

    @Autowired
    private AService aService;

    @RequestMapping(value = "/get")
    @ResponseBody
    public String getById(HttpServletRequest request) throws SQLException {
        return aService.getById();
    }


    @RequestMapping(value = "/get2")
    @ResponseBody
    public String get(@RequestBody Test test){
        return  test.getName();
    }
    @RequestMapping(value = "/get3")
    @ResponseBody
    public String get3(@RequestParam(value="name",required=false) String name){
        return  "get3: "+ name;
    }

    @RequestMapping(value = "/get4")
    public String get4(@RequestParam(value="name",required=false) String name){
        return  "redirect:/test/get5";
    }
    @RequestMapping(value = "/get5")
    @ResponseBody
    public String get5(){
        return  "aaaa";
    }


}
